<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>RVM : Coding Conventions</title>
        <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>

    <body>
        <div id="page">
            <div id="main">
                <div id="main-header" class="pageSectionHeader">
                    <h1 id="title-heading" class="pagetitle">
                                                <span id="title-text">
                            RVM : Coding Conventions
                        </span>
                    </h1>

                    <div class="page-metadata">
                        <p>This page last changed on Dec 21, 2011 by <font color="#0050B2">dgrove</font>.</p>
                    </div>
                </div>

                <div id="content" class="view">
                    <div id="main-content" class="wiki-content group">
                    <h3 id="CodingConventions-Assertions">Assertions</h3><p>Partly for historical reasons, we use our own built-in assertion facility rather than the one that appeared in Sun®'s JDK 1.4. All assertion checks have one of the two forms:</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>if (VM.VerifyAssertions)  VM._assert(condition)
    if (VM.VerifyAssertions)  VM._assert(condition,  message)</pre>
</div></div><p><code>VM.VerifyAssertions</code> is a <code>public static final</code> field. The <code>config.assertions</code> configuration variable determines <code>VM.VerifyAssertions</code>' value. If <code>config.assertions</code> is set to <code>none</code>, Jikes RVM has no assertion overhead.<br /> If you use the form without a <em>message</em>, then the default message &quot;<code>vm internal error at:</code>&quot; will appear.</p><p>If you use the form with a <em>message</em> the message <em>must</em> be a single string literal. Doing string appends in assertions can be a source of horrible performance problems when assertions are enabled (i.e. most development builds). If you want to provide a more detailed error message when the assertion fails, then you must use the following coding pattern:</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>if (VM.VerifyAssertions &amp;&amp;  condition) VM._assert(false,  message);</pre>
</div></div><p>An assertion failure is always followed by a stack dump.</p>
                    </div>

                    
                 
                </div>             </div> 
            <div id="footer" style="background: url(http://docs.codehaus.org/images/border/border_bottom.gif) repeat-x;">
                <p><small>Document generated by Confluence on Feb 17, 2012 10:24</small></p>
            </div>
        </div>     </body>
</html>
